#ifndef __TM1620_H_
#define __TM1620_H_

//引脚宏定义
#define DIN     P24
#define CLK     P25
#define STB     P26

//显示模式枚举类型
typedef enum
{
    Disp_Mode_GRID4_SEG10 = 0x00,       //4位10段
    Disp_Mode_GRID5_SEG9  = 0x01,       //5位9段
    Disp_Mode_GRID6_SEG8  = 0x02        //6位8段
}Disp_Mode_t;

//写数据地址模式枚举类型
typedef enum
{
    Write_Data_Addr_Auto_Add = 0x40,    //自动地址增加
    Write_Data_Addr_Fix      = 0x44     //固定地址
}Write_Data_Addr_Mode_t;

//辉度等级枚举类型
typedef enum
{
    Brightness_level_0  =   0x80,       //显示关
    Brightness_level_1  =   0x88,       //脉冲宽度为1/16
    Brightness_level_2  =   0x89,       //脉冲宽度为2/16
    Brightness_level_3  =   0x8A,       //脉冲宽度为4/16
    Brightness_level_4  =   0x8B,       //脉冲宽度为10/16
    Brightness_level_5  =   0x8C,       //脉冲宽度为11/16
    Brightness_level_6  =   0x8D,       //脉冲宽度为12/16
    Brightness_level_7  =   0x8E,       //脉冲宽度为13/16
    Brightness_level_8  =   0x8F,       //脉冲宽度为14/16
}Brightness_level_t;

//显示寄存器地址枚举类型    —>    位选GRID的地址
typedef enum
{
    Disp_SFR_Addr_Num   =   (uint8_t)12,

    Disp_SFR_Addr_00H   =   0xC0, 
    Disp_SFR_Addr_01H   =   0xC1,
    Disp_SFR_Addr_02H   =   0xC2,
    Disp_SFR_Addr_03H   =   0xC3,
    Disp_SFR_Addr_04H   =   0xC4,
    Disp_SFR_Addr_05H   =   0xC5,
    Disp_SFR_Addr_06H   =   0xC6,
    Disp_SFR_Addr_07H   =   0xC7,
    Disp_SFR_Addr_08H   =   0xC8,
    Disp_SFR_Addr_09H   =   0xC9,
    Disp_SFR_Addr_0AH   =   0xCA,
    Disp_SFR_Addr_0BH   =   0xCB,
}Disp_SFR_Addr_t;

//定义结构体类型
typedef struct
{
    Brightness_level_t  Brightness; //辉度变量

    void (*TM1620_Init)();          //TM1620初始化
    void (*Disp_Tempareture)();     //数码管显示温度
    
}TM1620_t;

/* extern variables-----------------------------------------------------------*/
extern TM1620_t idata TM1620;
/* extern function prototypes-------------------------------------------------*/ 

#endif
/********************************************************
  End Of File
********************************************************/